printing: Rename GTK_UNIT_PIXEL to GTK_UNIT_NONE
authorRyan Lortie <desrt@desrt.ca>
Mon, 20 Feb 2012 13:24:33 +0000 (13:24 +0000)
committerRyan Lortie <desrt@desrt.ca>
Fri, 4 May 2012 01:30:48 +0000 (18:30 -0700)
...and document that many functions don't accept "none" as a unit.

https://bugzilla.gnome.org/show_bug.cgi?id=460908

gtk/gtkenums.h
gtk/gtkpapersize.c
gtk/gtkprintcontext.c
gtk/gtkprintoperation.c
gtk/gtkprintutils.c

index a24ac26f7758156e8a8fa7c8e104cc9b2311d74d..e409d79c7eb0e8e850219e69e0fe1cc7af413eee 100644 (file)
@@ -753,12 +753,14 @@ typedef enum
 
 typedef enum
 {
-  GTK_UNIT_PIXEL,
+  GTK_UNIT_NONE,
   GTK_UNIT_POINTS,
   GTK_UNIT_INCH,
   GTK_UNIT_MM
 } GtkUnit;
 
+#define GTK_UNIT_PIXEL GTK_UNIT_NONE
+
 /**
  * GtkTreeViewGridLines:
  * @GTK_TREE_VIEW_GRID_LINES_NONE: No grid lines.
index deb4ea3175acc2ba50d39fd522df1c3337f4c98e..c4e7e0cd85750fd62452ed3e9e254330e016eb7d 100644 (file)
@@ -348,7 +348,7 @@ gtk_paper_size_new_from_ppd (const gchar *ppd_name,
  * @display_name: the human-readable name
  * @width: the paper width, in units of @unit
  * @height: the paper height, in units of @unit
- * @unit: the unit for @width and @height
+ * @unit: the unit for @width and @height. not %GTK_UNIT_NONE.
  *
  * Creates a new #GtkPaperSize object with the
  * given parameters.
@@ -367,7 +367,7 @@ gtk_paper_size_new_custom (const gchar *name,
 {
   GtkPaperSize *size;
   g_return_val_if_fail (name != NULL, NULL);
-  g_return_val_if_fail (unit != GTK_UNIT_PIXEL, NULL);
+  g_return_val_if_fail (unit != GTK_UNIT_NONE, NULL);
 
   size = g_slice_new0 (GtkPaperSize);
 
@@ -570,7 +570,7 @@ gtk_paper_size_get_ppd_name (GtkPaperSize *size)
 /**
  * gtk_paper_size_get_width:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the paper width of the #GtkPaperSize, in
  * units of @unit.
@@ -589,7 +589,7 @@ gtk_paper_size_get_width (GtkPaperSize *size,
 /**
  * gtk_paper_size_get_height:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the paper height of the #GtkPaperSize, in
  * units of @unit.
@@ -717,7 +717,7 @@ gtk_paper_size_get_default (void)
 /**
  * gtk_paper_size_get_default_top_margin:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the default top margin for the #GtkPaperSize.
  *
@@ -738,7 +738,7 @@ gtk_paper_size_get_default_top_margin (GtkPaperSize *size,
 /**
  * gtk_paper_size_get_default_bottom_margin:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the default bottom margin for the #GtkPaperSize.
  *
@@ -767,7 +767,7 @@ gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
 /**
  * gtk_paper_size_get_default_left_margin:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the default left margin for the #GtkPaperSize.
  *
@@ -788,7 +788,7 @@ gtk_paper_size_get_default_left_margin (GtkPaperSize *size,
 /**
  * gtk_paper_size_get_default_right_margin:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the default right margin for the #GtkPaperSize.
  *
index 3c604fa9b7c0179b40d4855540d97e1718343bd0..1de8f0c33f16861d6669aedf75fd3cb8b1ad0522 100644 (file)
@@ -214,7 +214,7 @@ gtk_print_context_set_cairo_context (GtkPrintContext *context,
   switch (context->op->priv->unit)
     {
     default:
-    case GTK_UNIT_PIXEL:
+    case GTK_UNIT_NONE:
       /* Do nothing, this is the cairo default unit */
       context->pixels_per_unit_x = 1.0;
       context->pixels_per_unit_y = 1.0;
@@ -292,7 +292,7 @@ _gtk_print_context_translate_into_margin (GtkPrintContext *context)
 
   g_return_if_fail (GTK_IS_PRINT_CONTEXT (context));
 
-  /* We do it this way to also handle GTK_UNIT_PIXELS */
+  /* We do it this way to also handle GTK_UNIT_NONE */
   left = gtk_page_setup_get_left_margin (context->page_setup, GTK_UNIT_INCH);
   top = gtk_page_setup_get_top_margin (context->page_setup, GTK_UNIT_INCH);
 
index 75212214e6a4e8e671edcff32e40b3f7d2230fd8..90b8d8ab5f5e157fa72577292171a268d49f0d28 100644 (file)
@@ -248,7 +248,7 @@ gtk_print_operation_init (GtkPrintOperation *operation)
   priv->page_drawing_state = GTK_PAGE_DRAWING_STATE_READY;
 
   priv->rloop = NULL;
-  priv->unit = GTK_UNIT_PIXEL;
+  priv->unit = GTK_UNIT_NONE;
 
   appname = g_get_application_name ();
   if (appname == NULL)
@@ -1233,7 +1233,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class)
                                                      P_("Unit"),
                                                      P_("The unit in which distances can be measured in the context"),
                                                      GTK_TYPE_UNIT,
-                                                     GTK_UNIT_PIXEL,
+                                                     GTK_UNIT_NONE,
                                                      GTK_PARAM_READWRITE));
   
   
index 07a50ba6c439ac6cbed7723971bf50a31a55b539..35affcf6e9596a41e68115680f132e4032ef93b6 100644 (file)
@@ -30,7 +30,6 @@ _gtk_print_convert_to_mm (gdouble len,
     case GTK_UNIT_INCH:
       return len * MM_PER_INCH;
     default:
-    case GTK_UNIT_PIXEL:
       g_warning ("Unsupported unit");
       /* Fall through */
     case GTK_UNIT_POINTS:
@@ -50,7 +49,6 @@ _gtk_print_convert_from_mm (gdouble len,
     case GTK_UNIT_INCH:
       return len / MM_PER_INCH;
     default:
-    case GTK_UNIT_PIXEL:
       g_warning ("Unsupported unit");
       /* Fall through */
     case GTK_UNIT_POINTS: